<?php
include './include/common.inc.php';
include './include/message.class.php';
require '../include/form.class.php';

$message = new message();
$action = isset( $action ) ? $action : 'manage';



if( $current_user === false )
{
	if( isset( $edufepm ) && $edufepm == 'iframe' )
	{
		$response->alert( '请您登陆后再访问' );
		$response->redirect( $base_dir . 'admin/login.php' );
		$response->execute();
	}
	else
	{
		showmessage( '请您登陆后再访问', $base_dir . 'admin/login.php' );
	}
}

switch( $action )
{
    case 'del_all':
        if( isset( $_POST['rid'] ) )
		{
			foreach ( $rid as $id )
			{
				$message->del( $id );
			}
			$response->alert( '删除成功！' );
			$response->script( 'self.location=self.location' );
			$response->execute();
		}
		else
		{
			$response->alert( '请选择要删除的信息' );
			$response->execute();
		}
        break;

    

    case 'manage':

    default:
        $page = isset( $page ) ? intval( $page ) : 1;
		$page = max( $page, 1 );
        $pagesize = 50;
		$list = $message->get_list(  $page, $pagesize );
        $type_list = $message->type_list;
        $pages = $message->pages;
		include template( 'admin', 'message_manage' );
        break;
}

?>
